home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u6.d64
/
printdir.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
7KB
|
240 lines
1 REM DIRECTORY PRINTER BY ROBERT FIELDER
2 REM DECEMBER 11,1985
3 REM THIS PROGRAMS RUNS SLOW BECAUSE OF THE SLOW STRING HANDLING IN THE 64.
4 REM THE MAIN MENU WILL ONLY SHOW VALID CHOICES AT ANY TIME.
5 REM IF NOT USING A 1525 OR MPS801 PRINTER, OR AN INTERFACE THAT THINKS IT
6 REM IT IS ONE OF THOSE, CHANGE OR REMOVE LINES 194,196,230,232
7 REM ALSE CHANGE LINES 180 AND 216 BY REMOVINE THE ,7 IF NECESSARY
8 REM CHANGE LINE 1060 TO ACCOMODATE DIFFERRENT NUMBER OF DIRECTORIES.
9 MA=21:REM MAXIMUM NUMBER OF DIRECTORIES. CHANGE AT WILL
10 DIM DIR$(MA,64),LE(MA,2)
11 POKE 53281,0:POKE53280,0:PRINT "[147]":PRINT CHR$(14)
12 S$=" ":NE$=" ([196][201][210][197][195][212][207][210][217] [195][207][206][212][201][206][213][197][196]) "
13 S2$=" ----------------------------------------------------"
14 S2$=S2$+"------------------------"
15 FOR LOOP=1 TO 4:GET A$:NEXT LOOP
16 PRINT "[147] [196][201][210][197][195][212][207][210][217][160][208][210][201][206][212][197][210] BY [210]OBERT [198]IELDER "
17 PRINT " [205][193][201][206] [205][197][206][213] [146]"
18 IF C2=MA THEN PRINT "":GOTO 21
19 PRINT" F1 [146] [204][207][193][196] [193][206][207][212][200][197][210] [196][201][210][197][195][212][207][210][217]"
20 IF C2=0 THEN PRINT "":GOTO 24
21 PRINT" F3 [146] [197][216][193][205][201][206][197] [196][201][210][197][195][212][207][210][201][197][211]"
22 PRINT" F5 [146] [208][210][201][206][212] [196][201][210][197][195][212][207][210][201][197][211]"
23 PRINT" F6 [146] [195][204][197][193][210] [205][197][205][207][210][217]"
24 PRINT" F8 [146] [209][213][201][212]"
25 PRINT " "C2"DIRECTORIES LOADED"
26 IF C2=MA THEN PRINT " [201]'M STUFFED !!!!! "
27 GET A$:IF A$="" THEN 27
28 FLAG=1
29 IF A$="[133]" AND C2<MA THEN GOSUB 35:GOTO 15
30 IF A$="[134]" AND C2>0 THEN GOSUB 93:GOTO 15
31 IF A$="[135]" AND C2>0 THEN GOSUB 152:GOTO 15
32 IF A$="[139]" AND C2>0 THEN PRINT"[147]":CLR:RUN
33 IF A$="[140]" THEN PRINT "[147]":END
34 GOTO 27
35 REM LOAD DIRECTORY
36 PRINT "[147] [204][207][193][196][201][206][199] #"C2+1"[157].....":C=0
37 OPEN15,8,15:OPEN 1,8,0,"$0":INPUT#15,A$,B$,L$,OU$
38 IFA$<>"00" THEN GOSUB 88:GOTO 70
39 C2=C2+1:GET#1,A$,B$:CO=0
40 L$="":CO=CO+1
41 GET#1,A$,B$
42 GET#1,A$,B$
43 C=0
44 IF A$<>"" THEN C=ASC(A$)
45 IF B$<>"" THEN C=C + ASC(B$)*256
46 L$=MID$(STR$(C),2)
47 IF LEN(L$)<3 THEN L$=" "+L$:GOTO47
48 L$=L$+" "
49 GET#1,B$:IF ST<>0 THEN 64
50 IF B$<>CHR$(34) THEN 49
51 GET#1,B$:IF B$<>CHR$(34) THEN L$=L$+B$:GOTO 51
52 GET#1,B$:IF B$=CHR$(32) THEN 52
53 IF LEN(L$)<21 THEN L$=L$+" ":GOTO 53
54 A$=""
55 A$=A$+B$:GET#1,B$:IF B$<>"" THEN 55
56 L$=L$+LEFT$(A$,3)
57 IF CO=1 AND C2>1 THEN GOSUB 73:ON C GOTO 58,67
58 DIR$(C2,CO)=L$:PRINT" ";:IF CO=1 THEN PRINT "";
59 PRINT L$;:IF CO=1 THEN PRINT "[146]";
60 PRINT
61 IF CO=64 AND ST=0 AND C2<MA THEN GOSUB 71
62 IF CO=64 AND ST=0 AND C2=MA THEN 66
63 IF ST=0 THEN 40
64 L$=" "+L$+"BLOCKS FREE ":PRINT " "L$
65 DIR$(C2,CO)=L$
66 LE(C2,1)=C2:LE(C2,2)=CO:DIR$(C2,0)=STR$(CO)
67 CLOSE1:CLOSE15
68 PRINT "YOU MAY NOW REMOVE THE DISK.....[145]"
69 Z=FRE(X)
70 RETURN
71 LE(C2,2)=CO:LE(C2,1)=C2:DIR$(C2,0)=STR$(CO):C2=C2+1:CO=2
72 DIR$(C2,1)=DIR$(C2-1,1):DIR$(C2,2)=NE$:RETURN
73 REM CHECK FOR DUPLICATE DIRECTORIES
74 IF L$<>DIR$(C2-1,1) THEN 76
75 PRINT "[147] [217][207][213] [202][213][211][212] [204][207][193][196][197][196] [212][200][201][211] [196][201][210][197][195][212][207][210][217]!!!! [146]":GOTO 81
76 FOR LOOP=1 TO C2-2
77 IF L$=DIR$(LOOP,1) THEN 79
78 NEXT LOOP:C=1:RETURN
79 PRINT"[147] [193] [196][201][211][203] [215][201][212][200] [212][200][201][211] [196][201][210][197][195][212][207][210][217] [146]"
80 PRINT " [200][193][211] [193][204][210][197][193][196][217] [194][197][197][206] [204][207][193][196][197][196] !! [146]"
81 PRINT " F1 [146] [195][207][206][212][201][206][213][197] [204][207][193][196][201][206][199]"
82 PRINT " F8 [146] [205][193][201][206][160][205][197][206][213]"
83 GET A$:IF A$="" THEN 83
84 IF A$="[133]" THEN C=1:GOTO 87
85 IF A$="[140]" THEN C=2:C2=C2-1:GOTO 87
86 GOTO 83
87 PRINT"[147]":RETURN
88 REM DIR ERROR
89 PRINT "[147] [196][201][211][203] [197][210][210][207][210]: [146] "A$" "B$" "L$" "OU$""
90 PRINT" [208][210][197][211][211][160][193][206][217][160][203][197][217][160][198][207][210][160][205][193][201][206][160][205][197][206][213]"
91 GET A$:IF A$="" THEN 91
92 CLOSE1:CLOSE15:RETURN
93 REM DISPLAY DIRECTORIES ON SCREEN
94 L$=" "
95 FIRST=1:LAST=24:C=1:B$="[133][145][134][135][157][136][139][140]"
96 IF LAST>LE(C,2)THENLAST=LE(C,2)
97 PRINT "[147]";TAB(27)" [196][201][210] #"C"[157] "
98 IF C2=1 THEN PRINT TAB(27)" 1 LOADED [146]":GOTO 103
99 PRINT TAB(25)" F1 [146] [208][193][199][197] [213][208]"
100 PRINT TAB(25)" F3 [146] [208][193][199][197] [196][207][215][206]"
101 PRINT TAB(25)" F5 [146] [204][197][198][212]"
102 PRINT TAB(25)" F7 [146] [210][201][199][200][212]"
103 PRINT TAB(25)" F6 [146] [210][197][205][207][214][197]"
104 PRINT TAB(25)" [196][201][210][197][195][212][207][210][217]"
105 PRINT TAB(25)" F8 [146] [205][193][201][206] [205][197][206][213]"
106 IF C2=1 THEN GOTO 110
107 PRINT TAB(27)""C2"[157] LOADED "
108 PRINT TAB(25)" [195]URSOR [203]EYS":PRINT TAB(25)" [215]ILL [193]LSO"
109 PRINT TAB(25)" [198]UNCTION"
110 FOR LOOP=1TOC2:LE(LOOP,1)=LOOP:LE(LOOP,2)=VAL(DIR$(LOOP,0)):NEXT LOOP
111 PRINT "";:FOR LOOP=1 TO 24:PRINT L$:NEXT LOOP
112 PRINT "";TAB(27)" [196][201][210] #"C"[157] "
113 PRINT "";:FOR LOOP=FIRST TO LAST:IFLOOP=1 THEN PRINT "";:
114 PRINT DIR$(C,LOOP):IFLOOP=1THENPRINT"[146]";
115 NEXTLOOP
116 FLAG=0
117 GET A$:IF A$="" THEN 117
118 IF A$="[140]" THEN RETURN
119 FOR LOOP=1 TO10:IF A$=MID$(B$,LOOP,1) THEN 121
120 NEXT LOOP
121 ON LOOP GOSUB 125,125,128,128,132,132,135,135,138,124
122 ON FLAG GOTO 116,124,97
123 GOTO 111
124 FLAG=1:RETURN
125 IF FIRST=1 THEN FLAG=1:RETURN:REM PAGE UP
126 FIRST=FIRST-24:IF FIRST<1 THEN FIRST=1
127 LAST=FIRST+23:RETURN
128 IF LAST=LE(C,2) THEN FLAG=1:RETURN:REM PAGE DOWN
129 FIRST=FIRST+24:LAST=FIRST+23
130 IF LAST>LE(C,2) THEN LAST=LE(C,2)
131 RETURN
132 IF C=1 THEN FLAG=1:RETURN:REM PAGE LEFT -1
133 C=C-1:FIRST=1:LAST=24:IF LAST>LE(C,2) THEN LAST=LE(C,2)
134 RETURN
135 IF C=C2 THEN FLAG=1:RETURN:REM PAGE RIGHT +1
136 C=C+1:FIRST=1:LAST=24:IF LAST>LE(C,2) THEN LAST=LE(C,2)
137 RETURN
138 IF C2=0 THEN RETURN:REM REMOVE A DIR
139 PRINT "[147] JUST A SEC.....":FLAG=3
140 IF C=MATHENFORZ=0TO64:DIR$(C,Z)="":NEXTZ:C=19:C2=19:GOTO149
141 FOR LOOP=C TO C2-1
142 FOR L2=0 TO 64
143 DIR$(LOOP,L2)=DIR$(LOOP+1,L2)
144 NEXT L2
145 LE(LOOP,1)=LE(LOOP+1,1)
146 LE(LOOP,2)=LE(LOOP+1,2)
147 NEXT LOOP
148 C2=C2-1:IF C2=0 THEN FLAG=2:RETURN
149 FIRST=1:LAST=24:IF LAST>LE(C,2)THEN LAST=LE(C,2)
150 RETURN
151 FLAG=2:RETURN:REM QUIT PROCEDURE
152 REM PRINT DIRECTORIES ON PRINTER
153 FOR LOOP=1TO4:GETA$:NEXTLOOP
154 PRINT "[147] [196][201][210][197][195][212][207][210][217][160][208][210][201][206][212][197][210] BY [210]OBERT [198]IELDER "
155 PRINT " [208][210][201][206][212] [205][197][206][213] [146]"
156 PRINT" F3 [146] [208][210][201][206][212] [193][211] [197][206][212][197][210][197][196]"
157 PRINT " F5 [146] [211][207][210][212] [207][206] [204][197][206][199][212][200] "
158 PRINT" F8 [146] [210][197][212][213][210][206] [212][207] [205][193][201][206] [205][197][206][213]"
159 PRINT " "C2"DIRECTORIES LOADED"
160 GET A$:IF A$="" THEN 160
161 IF A$="[134]" THEN 207
162 IF A$="[140]" THEN RETURN
163 IF A$<>"[135]" THEN 160
164 REM SORT LE()
165 PRINT "[147] [211][207][210][212][201][206][199]....."
166 C=0
167 FOR LOOP=1 TO C2-1
168 IF LE(LO,2)=>LE(LO+1,2) THEN 171
169 CO=LE(LO,2):LE(LO,2)=LE(LO+1,2):LE(LO+1,2)=CO
170 CO=LE(LO,1):LE(LO,1)=LE(LO+1,1):LE(LO+1,1)=CO:C=1
171 NEXT LOOP
172 IF C THEN 166
173 REM CONCAT AND PRINT
174 PRINT"[147] [208][210][197][208][193][210][197] [208][210][201][206][212][197][210]":PRINT " [212][200][197][206] [208][210][197][211][211] [193][206][217] [203][197][217] [212][207] [194][197][199][201][206]....
175 [153] " F8 WAIT (null)ATNRIGHT$(null) (null)VAL(null)(null)"
176 [129]LOOP[178]1[164]3:[161]A$:[130] LOOP
177 [161]A$:[139]A$[178]""[167] 177
178 [139] A$[178]"RESTORE" [167] [142]
179 [153] "LOAD (null)(null)RIGHT$(null)(null)RIGHT$(null)CHR$....."
180 [159] 4,4,7
181 [152]4,S2$:CO[178]1
182 [129] LOOP[178]1 [164] C2 [169] 3
183 [139]CO[178]66[167]CO[178]1:[152]4,S2$:[137]185
184 [139]CO[170]LE(LO,2)[177]65 [167] [141] 204
185 [129] L2[178]1 [164] LE(LOOP,2)
186 C[178]LE(LOOP,1)
187 C1[178]LE(LOOP[170]1,1)
188 C3[178]LE(LOOP[170]2,1)
189 OUT$[178]" "[170]DIR$(C,L2)[170]" "
190 [139] DIR$(C1,L2)[178]"" [167] [137] 194
191 OUT$[178]OUT$[170]DIR$(C1,L2)[170]" "
192 [139] DIR$(C3,L2)[178]"" [167] [137] 194
193 OUT$[178]OUT$[170]DIR$(C3,L2)
194 [139] L2[178]1 [167] [152]4,[199](27)"VAL"[199](27)"-"[199](1);
195 [152]4,OUT$:CO[178]CO[170]1
196 [139] L2[178]1 [167] [152]4,[199](27)"ASC"[199](27)"-"[199](0);
197 [130] L2
198 [152]4,S2$:CO[178]CO[170]1
199 [153] "LOAD OUT OF BREATH !!":Z[178][184](X)
200 [153] "LOAD (null)(null)RIGHT$(null)(null)RIGHT$(null)CHR$..... "
201 [130] LOOP
202 [160]4
203 [159]4,4:[129] L3[178]CO [164] 65:[152]4:[130] L3:[160]4:[142]
204 [143] JUMP TO NEW PAGE
205 [129] L3[178]CO [164] 65:[152]4:[130] L3
206 [152]4,S2$:CO[178]1:[142]
207 [143] PRINT AS ENTERED- NO SORT
208 [129] LOOP[178]1[164]C2:LE(LOOP,1)[178]LOOP:LE(LOOP,2)[178][197](DIR$(LOOP,0)):[130] LOOP
209 [153]"LOAD (null)(null)VAL(null)ATN(null)VAL (null)(null)RIGHT$(null)(null)VAL(null)":[153] " (null)LEFT$VAL(null) (null)(null)VAL(null)(null) ATN(null)(null) (null)VAL(null) (null)(null) PEEKVALCHR$RIGHT$(null)...
210 PRINT " F8 [146] [205][193][201][206] [205][197][206][213]"
211 FORLOOP=1TO3:GETA$:NEXT LOOP
212 GETA$:IFA$=""THEN 212
213 IF A$="[140]" THEN RETURN
214 PRINT "[147] [208][210][201][206][212][201][206][199]....."
215 L$=" "
216 OPEN 4,4,7
217 PRINT#4,S2$:CO=1
218 FOR LOOP=1 TO C2 STEP 3
219 Z=LE(LO,2):IF LE(LO+1,2)>Z THEN Z=LE(LO+1,2)
220 IF LE(LO+2,2)>Z THEN Z=LE(LO+2,2)
221 IFCO=66THENCO=1:PRINT#4,S2$:GOTO223
222 IFCO+Z>65 THEN GOSUB 204
223 FOR L2=1 TO Z
224 OUT$=" "+DIR$(LO,L2)+" "
225 IF DIR$(LO,L2)="" THEN OUT$=OUT$+L$
226 OUT$=OUT$+DIR$(LO+1,L2)+" "
227 IF DIR$(LO+1,L2)="" THEN OUT$=OUT$+L$
228 IF DIR$(LO+2,L2)="" THEN GOTO 230
229 OUT$=OUT$+DIR$(LO+2,L2)
230 IF L2=1 THEN PRINT#4,CHR$(27)"[197]"CHR$(27)"-"CHR$(1);
231 PRINT#4,OUT$:CO=CO+1
232 IF L2=1 THEN PRINT#4,CHR$(27)"[198]"CHR$(27)"-"CHR$(0);
233 NEXT L2
234 PRINT#4,S2$:CO=CO+1
235 PRINT "[147] OUT OF BREATH !!":Z=FRE(X)
236 PRINT "[147] [208][210][201][206][212][201][206][199]..... "
237 NEXT LOOP
238 CLOSE4
239 OPEN4,4:FOR L3=CO TO 65:PRINT#4:NEXT L3:CLOSE4:RETURN